package com.highspeed.bdk.controller.physical.service;

import com.highspeed.bdk.bean.entity.ViewPostion;
import com.highspeed.bdk.bean.entity.physical.*;
import com.highspeed.bdk.service.physical.*;
import org.springframework.beans.factory.annotation.Autowired;

public abstract class BaseDeviceServiceTester {

    @Autowired
    protected IPhysicalTopologyService physicalTopologyService;
    @Autowired
    protected IMachineBoxService machineBoxService;
    @Autowired
    protected IBoardService boardService;
    @Autowired
    protected ICpuService cpuService;
    @Autowired
    protected IPhysicalLinkService physicalLinkService;

    protected void createPhysicalLink(Cpu cpu, Cpu cpu1) {
        PhysicalLink link = new PhysicalLink();
        link.setPhysicalLinkID("link id");
        link.setLeftCpu(cpu);
        link.setRightCpu(cpu1);
       // link.setCreator("creator");
        physicalLinkService.save(link);
    }

    protected Cpu createCpu() {
        Cpu cpu = new Cpu();
        //cpu.setCreator("creator");
        cpu.setCpuId("CpuId");
        return cpu;
    }

    protected Board createBoard() {
        Board board = new Board();
     //   board.setCreator("creator");
        board.setBoardId("boardId");
        return board;
    }

    protected PhysicalTopology createPhysicalTopology() {
        PhysicalTopology physicalTopology = new PhysicalTopology();
        physicalTopology.setName("MachineBoxName");
        physicalTopology.setCreator("setCreator");
        physicalTopology.setNo("no");
        return physicalTopology;
    }

    protected MachineBox createMachineBox() {
        MachineBox mb = new MachineBox();
        mb.setMachineBoxName("MachineBoxName");
        mb.setMachineBoxNo("MachineBoxNo");
        mb.setRemark("Remark");
      //  mb.setCreator("Creator");
        return mb;
    }

    protected ViewPostion createViewPosition() {
        ViewPostion lvp = new ViewPostion();
        lvp.setIcon("icon");
        lvp.setX(1.0);
        lvp.setY(1.1);
        lvp.setWidth(2.2);
        lvp.setHeight(2.2);
        return lvp;
    }
}
